package com.learn.io.netty;

import io.netty.channel.Channel;
import io.netty.channel.ChannelHandlerContext;
import io.netty.channel.SimpleChannelInboundHandler;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;

/**
 * @author wangxing
 * @version 2020/7/30 15:53 Administrator
 */
public class CharNettyClientHandler extends SimpleChannelInboundHandler {
    Logger logger = LoggerFactory.getLogger(CharNettyClientHandler.class);
    /**
     * <strong>Please keep in mind that this method will be renamed to
     * {@code messageReceived(ChannelHandlerContext, I)} in 5.0.</strong>
     * <p>
     * Is called for each message of type {@ I}.
     *
     * @param ctx the {@link ChannelHandlerContext} which this {@link SimpleChannelInboundHandler}
     *            belongs to
     * @param msg the message to handle
     * @throws Exception is thrown if an error occurred
     */
    @Override
    protected void channelRead0(ChannelHandlerContext ctx, Object msg) throws Exception {
//        Channel channel = ctx.channel();
        logger.info("------------收到了消息:{}-----------",msg);
    }
}
